#include"jindutiao.h"
#include<unistd.h>
#include<string.h>
#define NUM 101
#define STYLE '='
void process1(double total,double current)
{
  char buffer[NUM];
  memset(buffer,0,sizeof(buffer));
  const char *lable="|/-\\";
  int len=strlen(lable);
  static int count=0;
  int num=(int)(current*100/total);
  for(int i=0;i<num;i++)
  {
    buffer[i]=STYLE;
  }
  double rate=current*100/total;
  count%=len;
  printf("[%-100s][%.1f%%][%c]\r",buffer,rate,lable[count]);
  count++;
  fflush(stdout);
}





void process()
{
  char buffer[NUM];
  memset(buffer,0,sizeof(buffer));
  const char *Lable="|/-\\";
  int len=strlen(Lable);
  int cnt=0;
  while(cnt<=100)
  {
    printf("[%-100s][%d%%][%c]\r",buffer,cnt,Lable[cnt%len]);
    fflush(stdout);
    buffer[cnt]=STYLE;
    cnt++;
    usleep(50000);
  }
  printf("\n");
}
